package com.system.service;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.auth.domain.T_function;
import com.auth.domain.T_role;
import com.auth.domain.T_role_function;
import com.auth.domain.T_user;
import com.auth.domain.T_user_function;
import com.auth.domain.T_user_role;
import com.auth.mapper.T_functionMapper;
import com.auth.mapper.T_roleMapper;
import com.auth.mapper.T_role_functionMapper;
import com.auth.mapper.T_userMapper;
import com.auth.mapper.T_user_functionMapper;
import com.auth.mapper.T_user_roleMapper;
import com.system.domain.T_data_dic;
import com.system.domain.T_login_log;
import com.system.mapper.T_data_dicMapper;
import com.system.mapper.T_login_logMapper;

@Service
@Transactional
public class T_logon_logService {
	private static Logger log = Logger.getLogger(T_logon_logService.class.getName());

	@Resource
	private T_login_logMapper loginlogMapper;

	public int saveLoginlog(T_login_log obj){
		return  loginlogMapper.save(obj);
	}

	public int countIp(T_login_log obj){
		return  loginlogMapper.countIp(obj);
	}

	public int countIpToday(T_login_log obj){
		return  loginlogMapper.countIpToday(obj);
	}

	public int countUser(T_login_log obj){
		return  loginlogMapper.countUser(obj);
	}

	/*
	 * 测试事务是否一致，是否在一个事务中，下面2个save有一个会报运行时错误，应该2条数据都不能插入数据库，就是事务控制回滚成功，否则失败；
	 */
	public int saveLoginlog(T_login_log obj1, T_login_log obj2){
		  loginlogMapper.save(obj1);
		  loginlogMapper.save(obj2);
		  return 0;
	}

}
